<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title> Jvm信息</title> <!--http://localhost:9049/page/client_tool_jvmInfo-->
</head>
<!-- layui样式 -->

<link rel="stylesheet" href="/components/editor/css/editormd.css">
<link rel="stylesheet" href="/components/layuiadmin/layui/src/css/layui.css" media="all">
<!---->

<script src="/manage/js/app.js"></script>
<body>
<br>
<div class="layui-row" style="letter-spacing: 0px; word-spacing: 0px; text-align: left; font-weight: 400; font-size: 16px; width: 100%;">
    <div class="layui-col-md6">
        <div class="layui-card">
            <div class="layui-card-header">
                CPU
            </div>
            <div class="layui-card-body" style="font-size: 25px;">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="background-color: rgb(255, 255, 255);border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">属性</th>
                        <th style="background-color: rgb(255, 255, 255);border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">值</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">核心数</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="availableProcessors"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">用户使用率</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="processCpuLoad"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">系统使用率</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="systemCpuLoad"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">cpu总使用率</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="unwantedCpuLoad"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="layui-col-md6">
        <div class="layui-card">
            <div class="layui-card-header">
                内存
            </div>
            <div class="layui-card-body" style="font-size: 25px;">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="background-color: rgb(255, 255, 255);border-left-style: hidden; border-right-style: hidden; border-top-style: hidden;">属性</th>
                        <th style="background-color: rgb(255, 255, 255);border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">内存</th>
                        <th style="background-color: rgb(255, 255, 255);border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">JVM</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">总内存</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="totalPhysicalMemorySize"></td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="totalMemory"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">已用内存</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="cpuUsableMemory"></td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="usableMemory"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">剩余内存</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="freePhysicalMemorySize"></td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="freeMemory"></td>
                    </tr>
                    <tr>
                        <td style="border-left-style: hidden; border-right-style: hidden;">使用率</td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="cpuUsageRate"></td>
                        <td style="border-left-style: hidden; border-right-style: hidden;" id="jvmUsageRate"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<br>
<div class="layui-card">
    <div class="layui-card-header">
        服务器信息
    </div>
    <div class="layui-card-body" style="background-color: rgb(255, 255, 255);">
        <small></small><small></small><i></i><small></small>
        <table class="layui-table">
            <thead>
            <tr>
                <th style="background-color: rgb(255, 255, 255);width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">服务器名称</th>
                <th style="background-color: rgb(255, 255, 255);width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">服务器IP</th>
                <th style="background-color: rgb(255, 255, 255);width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">操作系统</th>
                <th style="background-color: rgb(255, 255, 255);width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">系统架构</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="name"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="address">1</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="osName"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="osArch"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-header">
        JVM虚拟机信息
    </div>
    <div class="layui-card-body" style="background-color: rgb(255, 255, 255);">
        <small></small><small></small><i></i><small></small>
        <table class="layui-table">
            <thead>
            <tr>
                <th style="background-color: rgb(255, 255, 255); width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">java名称</th>
                <th style="background-color: rgb(255, 255, 255); width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;" id="jdkName"></th>
                <th style="background-color: rgb(255, 255, 255); width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">启用时间</th>
                <th style="background-color: rgb(255, 255, 255); width: 23.6937%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;" id="jvmStartTime"></th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;">java版本</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="jdkVersion"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;">运行时长</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="jvmRunTime"></td>
            </tr>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;">JDK路径</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="jdkHomeDir"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
            </tr>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;">项目路径</td>
                <td style="border-left-style: hidden; border-right-style: hidden;width: 35%; " id="projectDir"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
            </tr>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;">程序PID</td>
                <td style="border-left-style: hidden; border-right-style: hidden;width: 35%; " id="PID"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
                <td style="border-left-style: hidden; border-right-style: hidden;"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<div class="layui-card">
    <div class="layui-card-header">
        磁盘状态
    </div>
    <div class="layui-card-body" style="background-color: rgb(255, 255, 255);">
        <small></small><small></small><i></i><small></small>
        <table class="layui-table">
            <thead>
            <tr>
                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">盘符路径</th>
                <!--                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">文件系统</th>-->
                <!--                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">盘符类型</th>-->
                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">总大小</th>
                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">可用大小</th>
                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">已用大小</th>
                <th style="background-color: rgb(255, 255, 255); width: 13.3447%; border-left-style: hidden; border-right-style: hidden;border-top-style: hidden;">已用百分比</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td style="border-left-style: hidden; border-right-style: hidden;">/</td>
                <!--                <td style="border-left-style: hidden; border-right-style: hidden;"></td>-->
                <!--                <td style="border-left-style: hidden; border-right-style: hidden;"></td>-->
                <td style="border-left-style: hidden; border-right-style: hidden;" id="fileTotal">GB</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="fileFree"> GB</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="fileUse"> GB</td>
                <td style="border-left-style: hidden; border-right-style: hidden;" id="fileUseUsageRate"></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<br>
<br>
<script>
    let jvmInfoUrl =  path +"/admin/xj/jvm/jvmInfo";

    init();
    setInterval("init()", 1000 * 60);

    // setInterval(function () {
    function init() {
        let jvmInfo = Ajax.get(jvmInfoUrl).data;
        // cpu
        $("#processCpuLoad").html(jvmInfo.cpu.userUtilization + " %");     // cpu用户占用率
        $("#systemCpuLoad").html(jvmInfo.cpu.systemUtilization + " %");     // cpu系统占用率
        $("#unwantedCpuLoad").html(jvmInfo.cpu.usageRate + " %");            // cpu总使用率
        $("#availableProcessors").html(jvmInfo.cpu.numberOfCores);         // cpu核心数

        // jvm内存
        $("#totalMemory").html(jvmInfo.jvmRam.totalMemory + " MB");           // JVM最大获取内存
        $("#freeMemory").html(jvmInfo.jvmRam.remainingMemory + " MB");       // JVM剩余内存
        $("#usableMemory").html(jvmInfo.jvmRam.usedMemory + " MB");          // JVM已使用内存
        $("#jvmUsageRate").html(jvmInfo.jvmRam.usageRate + " %");            // JVM使用率

        // 系统内存
        $("#totalPhysicalMemorySize").html(jvmInfo.ram.totalMemory + " GB");      // 内存最大获取内存
        $("#freePhysicalMemorySize").html(jvmInfo.ram.remainingMemory + " GB");   // 内存剩余内存
        $("#cpuUsableMemory").html(jvmInfo.ram.usedMemory + " GB");               // 内存已使用内存
        $("#cpuUsageRate").html(jvmInfo.ram.usageRate + " %");                    // 内存使用率

        // 主机和系统信息(hostInfo|osInfo )
        $("#name").html(jvmInfo.serverInformation.name);              // 主机名
        $("#address").html(jvmInfo.serverInformation.ip);             // 主机ip
        $("#osName").html(jvmInfo.serverInformation.operatingSystem); // 系统
        $("#osArch").html(jvmInfo.serverInformation.systemStructure); // 系统架构

        // jdk信息
        $("#jdkName").html(jvmInfo.jvmInformation.javaName);          // java版本名称
        $("#jdkVersion").html(jvmInfo.jvmInformation.javaVersion);    // java版本
        $("#jdkHomeDir").html(jvmInfo.jvmInformation.jdkPath);        // java路径
        $("#PID").html(jvmInfo.jvmInformation.pid);                   // java路径
        $("#projectDir").html(jvmInfo.jvmInformation.projectPath);    // 项目路径
        $("#jvmStartTime").html(jvmInfo.jvmInformation.startTime);    // jvm启动时间
        $("#jvmRunTime").html(TimeUtil.DateDifference(jvmInfo.jvmInformation.startTime, new Date().getTime())); // jvm运行时长

        // 硬盘信息(总大小/剩余/已用/已用百分比)
        $("#fileTotal").html(jvmInfo.fileInfo.total + " GB");
        $("#fileFree").html(jvmInfo.fileInfo.free + " GB");
        $("#fileUse").html(jvmInfo.fileInfo.usable + " GB");
        $("#fileUseUsageRate").html(jvmInfo.fileInfo.usedRatio + "%");
    }
</script>
</body>